export interface CouponData {
  id: number
  name: string
  type: number // 1-满减券，2-折扣券
  value: number
  minConsume: number
  useStartTime: string
  useEndTime: string
  description: string
  total: number // 发行量，-1表示不限量
  remain: number // 剩余数量
  issueType: number // 1-自动发放，2-手动领取
  issueCondition: string // first_order-首次下单，activity-活动优惠券
  status: number // 1-正常，0-失效
  isIssued: boolean // 是否已发放
  createTime: string
  updateTime: string
  receiveStartTime: string // 领取开始时间
  receiveEndTime: string // 领取结束时间
  receiveLimitNum: number // 每人限领数量，-1表示不限量
}

export interface CreateCouponRequestData {
  name: string
  type: number
  value: number
  minConsume: number
  useStartTime: string
  useEndTime: string
  description?: string
  total: number
  issueType: number
  issueCondition: string
  receiveStartTime: string
  receiveEndTime: string
  receiveLimitNum: number
}

export interface UpdateCouponRequestData extends CreateCouponRequestData {
  id: number
}

export interface GetCouponRequestData {
  pageNo: number
  pageSize: number
  name?: string
  type?: number
  status?: number
  issueType?: number
  issueCondition?: string
}

export type CouponResponseData = ApiResponseData<{
  list: CouponData[]
  total: number
}>

// 用户优惠券相关类型
export interface UserCouponData {
  id: number
  userId: number
  couponId: number
  status: number // 1-可用，2-已使用，3-已过期
  useTime: string | null
  orderId: string | null
  createTime: string
  // 关联的优惠券信息
  coupon?: CouponData
}

export interface GetUserCouponRequestData {
  pageNo: number
  pageSize: number
  userId?: number
  status?: number
  couponName?: string
}

export type UserCouponResponseData = ApiResponseData<{
  list: UserCouponData[]
  total: number
}>